import 'package:flutter/material.dart';
import 'package:banquanjie_app/app/services/screenAdapter.dart';
class ProjectCard extends StatelessWidget {
  final Map item;
  const ProjectCard({required this.item, super.key});
  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.all(ScreenAdapter.width(20)),
      width: ScreenAdapter.width(710),
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.circular(ScreenAdapter.width(10))
      ),
      child: Row(
        children: [
          Stack(
            children: [
              Container(
                width: ScreenAdapter.width(200),
                clipBehavior: Clip.hardEdge,
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(ScreenAdapter.width(10))
                ),
                child: AspectRatio(
                  aspectRatio: 2/3,
                  child: Image.network(
                    "${item['coverOssUrl']}",
                    fit: BoxFit.cover
                  ),
                ),
              ),      
              Positioned(
                bottom:0,
                right: 0,
                left: 0,
                child: Container(
                  height: ScreenAdapter.width(40),
                  padding: EdgeInsets.only(left: ScreenAdapter.width(4)),
                  decoration: BoxDecoration(
                    color: Colors.black,
                    borderRadius: BorderRadius.only(
                      bottomLeft: Radius.circular(ScreenAdapter.width(10)),
                      bottomRight: Radius.circular(ScreenAdapter.width(10))
                    ),
                  ),
                  child: Row(
                    children: [
                      ClipRRect(
                        child: Image.network(
                          'https://zsjl.oss-cn-beijing.aliyuncs.com/test/xcx/see_count_icon.png',
                          width: ScreenAdapter.width(14),
                          height: ScreenAdapter.width(14),
                          fit: BoxFit.cover,
                        ),
                      ),
                      SizedBox(width: ScreenAdapter.width(10)),
                      Text("${item['seeNum']}", style: TextStyle(fontSize: ScreenAdapter.fontSize(20), color: Colors.white)),
                      SizedBox(width: ScreenAdapter.width(20)),
                      ClipRRect(
                        child: Image.network(
                          'https://zsjl.oss-cn-beijing.aliyuncs.com/test/xcx/see_count_icon.png',
                          width: ScreenAdapter.width(14),
                          height: ScreenAdapter.width(14),
                          fit: BoxFit.cover,
                        ),
                      ),
                      Text("${item['collectNum']}", style: TextStyle(fontSize: ScreenAdapter.fontSize(20), color: Colors.white)),
                    ],
                  )
                )
              )
            ]
          ),
          SizedBox(
            width: ScreenAdapter.width(16),
          ),
          Expanded(
            flex: 1,
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Container(
                  margin: EdgeInsets.only(bottom: ScreenAdapter.width(4)),
                  height: ScreenAdapter.width(36),
                  child: Row(
                    crossAxisAlignment: CrossAxisAlignment.center,
                    children: [
                      if (item['projectTypeFirstName'] != null)
                        Container(
                          margin: EdgeInsets.only(right: ScreenAdapter.width(14)),
                          height: ScreenAdapter.width(24),
                          constraints: BoxConstraints(minWidth: ScreenAdapter.width(52)),
                          padding: EdgeInsets.symmetric(horizontal: ScreenAdapter.width((6))),
                          decoration: BoxDecoration(
                            color: const Color(0xFFF0F2F5),
                            borderRadius: BorderRadius.circular(ScreenAdapter.width(4)),
                          ),
                          alignment: Alignment.center,
                          child: Text(
                            item['projectTypeFirstName'],
                            style: TextStyle(
                              fontSize: ScreenAdapter.fontSize(22),
                              height: 1.0,
                              fontWeight: FontWeight.w500,
                            ),
                          ),
                        ),
                      Expanded(
                        child: Text(
                          item['projName'] ?? '',
                          style: TextStyle(
                            fontSize: ScreenAdapter.fontSize(28),
                            fontWeight: FontWeight.w600,
                          ),
                          overflow: TextOverflow.ellipsis,
                          maxLines: 1,
                        ),
                      ),
                    ],
                  ),
                ),
                Text('${item['projectTypeSecondName'].replaceAll(',', ' / ')}', style: TextStyle(height: 1.7, fontSize: ScreenAdapter.fontSize(26), color: Colors.black, letterSpacing: -2.0)),
                if (item['filmType'] == 196 || item['filmType'] == 197)
                  Text('报审状态：${item['projectPhaseName'] == 1 ? '已报审' : '未报审'}', style: TextStyle(height: 1.7, fontSize: ScreenAdapter.fontSize(26), color: Colors.black, letterSpacing: -2.0)),
                Text('阶段：${item['projectPhaseName']}', style: TextStyle(height: 1.7, fontSize: ScreenAdapter.fontSize(26), color: Colors.black, letterSpacing: -2.0)),
                if (item['financingStartTime'].isNotEmpty)
                  Text('周期：${item['projectPhaseName']}', style: TextStyle(height: 1.7, fontSize: ScreenAdapter.fontSize(26), color: Colors.black, letterSpacing: -2.0)),
                Text('简介：${item['projectIntro']}', maxLines: 2, overflow: TextOverflow.ellipsis, style: TextStyle(height: 1.7, fontSize: ScreenAdapter.fontSize(26), color: Colors.black, letterSpacing: -2.0)),
              ],
            )
          )
        ]
      )
    );
  }
}